package a.j;

class ud
{
  static final byte a = 0;
  static final byte b = 1;
  static final byte c = 2;
  static final byte e = 3;
  
  static void a(pg parampg, tb paramtb, boolean paramBoolean)
  {
    a(parampg, paramtb, paramBoolean, (byte)3);
  }
  
  static byte a(pg parampg, tb paramtb, boolean paramBoolean, byte paramByte)
  {
    zd localzd = paramBoolean ? paramtb.k() : paramtb.l();
    ld localld = paramBoolean ? paramtb.h() : paramtb.g();
    return a(parampg, paramtb, localzd.a(localld), localzd.b(localld), paramBoolean, paramByte);
  }
  
  static void a(tb paramtb, int paramInt, double paramDouble1, double paramDouble2)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    Object localObject;
    ld localld;
    double d1;
    double d2;
    if (!bool2) {
      if (paramInt == 0)
      {
        localeb = paramtb.p();
        localObject = paramtb.k();
        localld = paramtb.h();
        d1 = ((zd)localObject).a(localld);
        d2 = ((zd)localObject).b(localld);
        if (!bool2) {
          if (Math.abs(localeb.b() - d1) > Math.abs(localeb.c() - d2))
          {
            paramDouble2 = d2;
            if (bool2) {
              break label104;
            }
            if (!bool1) {
              break label103;
            }
          }
        }
        paramDouble1 = d1;
      }
    }
    label103:
    label104:
    if (paramInt == paramtb.n() - 1)
    {
      localeb = paramtb.q();
      localObject = paramtb.l();
      localld = paramtb.g();
      d1 = ((zd)localObject).a(localld);
      d2 = ((zd)localObject).b(localld);
      if (!bool2) {
        if (Math.abs(localeb.b() - d1) > Math.abs(localeb.c() - d2))
        {
          paramDouble2 = d2;
          if (bool2) {
            break label205;
          }
          if (!bool1) {
            break label197;
          }
        }
      }
      paramDouble1 = d1;
    }
    label197:
    eb localeb = paramtb.b(paramInt);
    label205:
    if (!bool2) {
      if (paramInt > 0)
      {
        localObject = paramtb.b(paramInt - 1);
        if (!bool2) {
          if (Math.abs(((eb)localObject).b() - localeb.b()) < Math.abs(((eb)localObject).c() - localeb.c()))
          {
            ((eb)localObject).a(paramDouble1, ((eb)localObject).c());
            if (bool2) {
              break label293;
            }
            if (!bool1) {
              break label292;
            }
          }
        }
        ((eb)localObject).a(((eb)localObject).b(), paramDouble2);
      }
    }
    label292:
    label293:
    if (paramInt < paramtb.n() - 1)
    {
      localObject = paramtb.b(paramInt + 1);
      if (!bool2) {
        if (Math.abs(((eb)localObject).b() - localeb.b()) < Math.abs(((eb)localObject).c() - localeb.c()))
        {
          ((eb)localObject).a(paramDouble1, ((eb)localObject).c());
          if (bool2) {
            return;
          }
          if (!bool1) {
            break label381;
          }
        }
      }
      ((eb)localObject).a(((eb)localObject).b(), paramDouble2);
    }
    label381:
    localeb.a(paramDouble1, paramDouble2);
  }
  
  static void a(pg parampg, tb paramtb, double paramDouble1, double paramDouble2, boolean paramBoolean)
  {
    a(parampg, paramtb, paramDouble1, paramDouble2, paramBoolean, (byte)3);
  }
  
  static byte a(pg parampg, tb paramtb, double paramDouble1, double paramDouble2, boolean paramBoolean, byte paramByte)
  {
    boolean bool = ld.E;
    if (!bool) {
      if (paramtb.n() > 0)
      {
        localObject1 = paramBoolean ? paramtb.p() : paramtb.q();
        if (!bool) {
          if (paramtb.n() > 1)
          {
            if (!bool) {}
            localObject2 = paramtb.b(paramBoolean ? 1 : paramtb.n() - 2);
            d1 = ((eb)localObject2).b();
            d3 = ((eb)localObject2).c();
            if ((!bool) && (!ld.D)) {
              break label153;
            }
          }
        }
        Object localObject2 = paramBoolean ? paramtb.l() : paramtb.k();
        ld localld2 = paramBoolean ? paramtb.g() : paramtb.h();
        double d1 = ((zd)localObject2).a(localld2);
        double d3 = ((zd)localObject2).b(localld2);
        label153:
        double d5 = ((eb)localObject1).b();
        double d7 = ((eb)localObject1).c();
        if (!bool)
        {
          if (1 != paramByte)
          {
            if (bool) {
              break label243;
            }
            if (2 == paramByte) {
              break label235;
            }
            if (bool) {
              break label236;
            }
            if (Math.abs(d5 - d1) <= Math.abs(d7 - d3)) {
              break label235;
            }
          }
          if (bool) {}
        }
        else if (0 != paramByte)
        {
          ((eb)localObject1).a(paramDouble1, d3);
        }
        return 1;
        label235:
        label236:
        if (!bool) {
          if (0 != paramByte) {
            label243:
            ((eb)localObject1).a(d1, paramDouble2);
          }
        }
        return 2;
      }
    }
    Object localObject1 = paramBoolean ? paramtb.l() : paramtb.k();
    ld localld1 = paramBoolean ? paramtb.g() : paramtb.h();
    double d2 = ((zd)localObject1).a(localld1);
    double d4 = ((zd)localObject1).b(localld1);
    double d6 = d2 - paramDouble1;
    double d8 = d4 - paramDouble2;
    double d9;
    if (!bool)
    {
      if (1 != paramByte)
      {
        if (bool) {
          break label449;
        }
        if (2 == paramByte) {
          break label441;
        }
        if (bool) {
          break label442;
        }
        if (Math.abs(d6) <= Math.abs(d8)) {
          break label441;
        }
      }
      if (bool) {}
    }
    else if (0 != paramByte)
    {
      if (bool) {
        break label440;
      }
      if (paramDouble2 != d4)
      {
        d9 = a(parampg, paramDouble1 + d6 * 0.5D);
        paramtb.a(d9, paramBoolean ? paramDouble2 : d4);
        paramtb.a(d9, paramBoolean ? d4 : paramDouble2);
      }
    }
    label440:
    return 1;
    label441:
    label442:
    if (!bool) {
      if (0 != paramByte)
      {
        label449:
        if (bool) {
          break label514;
        }
        if (paramDouble1 != d2)
        {
          d9 = c(parampg, paramDouble2 + d8 * 0.5D);
          paramtb.a(paramBoolean ? paramDouble1 : d2, d9);
          paramtb.a(paramBoolean ? d2 : paramDouble1, d9);
        }
      }
    }
    label514:
    return 2;
  }
  
  protected static double a(pg parampg, double paramDouble)
  {
    boolean bool = ld.E;
    if ((bool) || (parampg != null))
    {
      if (bool) {
        break label29;
      }
      if (parampg.u()) {}
    }
    else
    {
      return paramDouble;
    }
    label29:
    double d = parampg.w();
    return Math.floor(paramDouble / d + 0.5D) * d;
  }
  
  protected static double c(pg parampg, double paramDouble)
  {
    boolean bool = ld.E;
    if ((bool) || (parampg != null))
    {
      if (bool) {
        break label29;
      }
      if (parampg.u()) {}
    }
    else
    {
      return paramDouble;
    }
    label29:
    double d = parampg.w();
    return Math.floor(paramDouble / d + 0.5D) * d;
  }
}


/* Location:           E:\idea\
 * Qualified Name:     a.j.ud
 * JD-Core Version:    0.7.0.1
 */